import 'package:flutter/material.dart';
import 'package:hello_flutter/my_text_view.dart';

/**
 * 计数器
 */
class MyHomePage extends StatelessWidget {

  final FTextView tv = FTextView(content: "i = 0, click to add");

  final String title;

  MyHomePage({Key key, this.title}) :super(key: key);

  var i = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text(title)),
        body: Center(
            child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  tv,
                  FloatingActionButton(
                    onPressed: () {
                      i++;
                      tv.setText("$i");
                    },
                  )
                ]
            )
        )
    );
  }
}